<div class="float-right" style="width: 300px; text-align: right;">
    <div class="user_box round_all">
        <a id="agent-profile-photo" class="inline-block valign-top" href="<?php echo $this->createUrl('/account/profile'); ?>">
			<?php
			if (!empty(Yii::app()->user->model->photo) && file_exists($_SERVER['DOCUMENT_ROOT'] . Yii::app()->user->model->photo)) {
				echo CHtml::image(Yii::app()->user->model->getPhoto(), Yii::app()->user->model->getDisplayName(), array('width' => 25));
			} else {
				echo CHtml::image('/images/icons/user.jpg', 'Upload photo', array('width' => '25', 'class' => 'no-photo tooltip-bottom', 'title' => 'Upload Photo'));
			}
			?>
        </a>
        <span class="inline-block align-left" style="max-width: 180px">
            <h2>
                <a href="<?php echo $this->createUrl('/account/profile'); ?>">
					<?php
					if (Yii::app()->user->isGuest) {
						echo 'Guest';
					} else {
						echo CHtml::encode(Yii::app()->user->model->getDisplayName());
					}
					?>
                </a>
            </h2>
            <h3>
                <span class="credits">
					<?php
					if (!Yii::app()->user->isGuest) {

						echo "Credits: " . CHtml::link("$" . Yii::app()->user->model->credits, array('/account/credit/buy'), array(
							'class' => 'tooltip-bottom' . (Yii::app()->user->model->isLowOnCredit ? ' red' : ''),
							'title' =>
							'Remaining uses:'
							. '<br/>' . PsActionCost::getEstimate('sms', Yii::app()->user->model->credits) . ' SMSes'
						));

						if (Yii::app()->user->model->isLowOnCredit) {
							echo '<p><span class="red">Low credit: <a href="' . $this->createUrl('/account/credit/buy') . '" class="red link">Please top up</a>.</span></p>';
						}
					} else {
						echo '&nbsp;';
					}
					?>
                </span>
            </h3>
        </span>
    </div><!-- #user_box -->
</div>